keycon
Keyboard Controller
Installation
npm i keycon
<script src="https://daybrush.com/keycon/release/latest/dist/keycon.min.js"></script>
How to use
import KeyController, { getCombi, getKey } from "keycon";
const keycon = new KeyController();
keycon.on("blur", () => {
console.log("blur");
});
keycon.keydown(e => {
console.log(e);
});
keycon.keydown("space", e => {
console.log(e);
});
keycon.keydown(["alt", "space"], e => {
console.log(getCombi(e));
console.log(getKey(e.keyCode));
console.log(e);
});
keycon.keyup(e => {
console.log(e);
});
keycon.keydown("space", e => {
console.log(e);
});
keycon.keyup(["alt", "space"], e => {
console.log(e);
});